# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=codetective
pkgver=45.52b91f1
pkgrel=4
groups=('blackarch' 'blackarch-crypto')
pkgdesc='A tool to determine the crypto/encoding algorithm used according to traces of its representation.'
arch=('any')
url='https://www.digitalloft.org/init/plugin_wiki/page/codetective'
license=('custom:unknown')
depends=('python2')
makedepends=('git')
source=("$pkgname::git+git://github.com/blackthorne/Codetective.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|/usr/bin/env python|/usr/bin/env python2|' "$pkgname.py"
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 "$pkgname.py" "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md "$pkgname.py"

  cp -a * "$pkgdir/usr/share/$pkgname/"
}

